Add a extract-function-index pass - #3939
Conversation
| "flatten", "flattens out code, removing nesting", createFlattenPass); | ||
| registerPass("extract-function-index", | ||
| "leaves just one function selected by index", | ||
| createExtractFunctionIndexPass), |
There was a problem hiding this comment.
| createExtractFunctionIndexPass), | |
| createExtractFunctionIndexPass); |
then the indentation below would be fixed by clang-format
| ;; CHECK-NEXT: ) | ||
|
|
||
| (module | ||
| ;; Use another function in the table, but the table is not used in the |
There was a problem hiding this comment.
| ;; Use another function in the table, but the table is not used in the | |
| ;; Use a function in the table, but the table is not used in the |
A downside of separate lit files is that we can't have a "conversation" about their connections...
There was a problem hiding this comment.
Hmmm. Will whip something up to help out here.
| ;; CHECK-NEXT: ) | ||
|
|
||
| (module | ||
| ;; Use another function in the table, and the table *is* used. As a result, |
There was a problem hiding this comment.
| ;; Use another function in the table, and the table *is* used. As a result, | |
| ;; Use a function in the table, and the table *is* used. As a result, |
|
@kripken, I added a way to have multiple modules in a single lit test. PTAL! Edit: If this looks good, I plan to split |
| ;; CHECK-NEXT: (func $foo | ||
| ;; CHECK-NEXT: (call $bar) | ||
| ;; CHECK-NEXT: ) | ||
| ;; CHECK-NEXT: ) |
There was a problem hiding this comment.
These are manually-created, correct? I worry about us accumulating a lot of those and having a bad time some day when we need to update them. Adding foreach seems like it would increase the amount of such test code... How hard would it be to support auto updating in these eventually?
There was a problem hiding this comment.
Yes, these are manually created for now. I think it would be reasonable to update the auto update script in the near future to handle multiple multiple modules in a file and also to give it an option to emit checks on a per-module rather than a per-function basis.
The major drawback of lit tests is that so far they have only supported a single module per test file. This commit adds a new utility script that splits an input file into multiple files and runs a command on each of them, giving lit tests a simple way to test multiple modules per file.
This is a useful alternative to extract-function when you don't know the function's name. Also moves the extract-function tests to be lit tests and re-uses them as extract-function-index tests.
c0d2047 to
d15fed6
Compare
This is a useful alternative to extract-function when you don't know the
function's name.
Also moves the extract-function tests to be lit tests and re-uses them as
extract-function-index tests.